project(cman_uapi)
cmake_minimum_required(VERSION 3.22)

set(CMANUAPI_DIR "${PROJECT_SOURCE_DIR}")
set(CMANUAPI_DIR "${PROJECT_SOURCE_DIR}" PARENT_SCOPE)
message(STATUS "CMANUAPI DIR ${CMANUAPI_DIR}")

if(NOT ENABLE_ASAN AND NOT ENABLE_COV)
    add_compile_options(-fPIE)
    add_link_options(-pie)
endif()

find_package(Boost COMPONENTS program_options REQUIRED)

add_library(cmanuapi STATIC)
set_property(TARGET cmanuapi PROPERTY POSITION_INDEPENDENT_CODE ON)

target_sources(cmanuapi INTERFACE cmanuapi.h)
target_sources(cmanuapi PRIVATE cmanuapi.c)

message(STATUS "compile options ${CMAN_COMPILE_OPTIONS}")
add_compile_options(${CMAN_COMPILE_OPTIONS} -std=c++17)

add_executable(devcman devcman.cpp)

target_include_directories(devcman PRIVATE ${Boost_INCLUDE_DIR})
target_link_libraries(devcman cmanuapi ${Boost_LIBRARIES})